package kr.hkit.androidcomplete01.ch16;

import java.io.File;

import kr.hkit.androidcomplete01.R;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

public class CallOther extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch17_callother);
	}
	
	public void mOnClick(View v){
		Intent intent;
		switch (v.getId()){
		case R.id.web:
			intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.naver.com"));
			startActivity(intent);
			break;
		case R.id.dial:
			intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:015-123-1412"));
			startActivity(intent);
			break;
		case R.id.picture:
			intent = new Intent(Intent.ACTION_VIEW);
			String sd = Environment.getExternalStorageDirectory().getAbsolutePath();
	//		Toast.makeText(this, sd, Toast.LENGTH_SHORT).show();
			Log.d("CallOther", "외부 저장경로"+sd);
			Uri uri = Uri.fromFile(new File(sd + "/test.jpg"));
			intent.setDataAndType(uri, "image/jpeg");
			startActivity(intent);
			break;
		case R.id.other:
			intent = new Intent(Intent.ACTION_MAIN);
			intent.setComponent(new ComponentName("exam.memo", "exam.memo.Memo")); //패키지명, 패키지명.클래스
			//intent.setClassName("exam.memo", "exam.memo.Memo");
			startActivity(intent);
			break;
		}
	}
}
